<template>
  <div></div>
</template>

<script setup>
// import.meta.env.VITE_INFURA_MAINNET
// import.meta.env.VITE_INFURA_SEPOLIA
import { JsonRpcProvider, formatEther, Contract } from 'ethers';
const provider = new JsonRpcProvider(import.meta.env.VITE_INFURA_SEPOLIA);
// const provider = new JsonRpcProvider('https://rpc.ankr.com/eth');
// const proveder = new ethers.BrowserProvider(null, import.meta.env.VITE_INFURA_SEPOLIA);
async function main() {
  // const balance = await provider.getBalance(`vitalik.eth`);
  // const adress = await provider.resolveName(`vitalik.eth`);
  let blockNumber = await provider.getBlockNumber();
  let balance = formatEther(
    await provider.getBalance('0xeC54D4F0cd654e0339f37ea64064e2533A3A0adf')
    // await provider.getBalance(adress)
  );
  let count = await provider.getTransactionCount('0xeC54D4F0cd654e0339f37ea64064e2533A3A0adf');
  let feeData = await provider.getFeeData();
  const code = await provider.getCode('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2');
  // console.log('balance', balance, count, feeData, formatEther(feeData.gasPrice));
  // console.log('code', code);
  const abiERC20 = [
    'function name() view returns (string)',
    'function symbol() view returns (string)',
    'function totalSupply() view returns (uint256)',
    'function balanceOf(address) view returns (uint)'
  ];
  const addressDAI = '0x6B175474E89094C44Da98b954EedeAC495271d0F'; // DAI Contract
  const contractDAI = new Contract(addressDAI, abiERC20, provider);
  // let name = await contractDAI.name();
  console.log('contractDAI', contractDAI);
}
main();
// console.log('provideEth', provideEth);
</script>

<style lang="scss" scoped></style>
